<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>苏宁易购：我的购物车</title>  
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="shortcut icon" href="http://localhost/project/shop/Static/Index/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/global.css" />
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/cart.css" />
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/animate.min.css"/>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/common.js"></script>  
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/scrolltopcontrol.js"></script>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/jquery.hDialog.js"></script>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/cart.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/DD_belatedPNG.js"></script>
<script>
    DD_belatedPNG.fix(".img_logo", "img");
</script>
<![endif]-->
<script type="text/javascript">
	var price_url = "<?php echo U('Cart/price_url');?>";
	var price_reduce = "<?php echo U('Cart/price_reduce');?>";
	var del_sid = "<?php echo U('Cart/del_sid');?>";
	var order ="<?php echo U('Order/index');?>";
</script>
</head>
<body>
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!--S header-->
	<div class="header">
		<div class="top_c">
			<div class="top_c_r">
				<ul class="top_list">

					    <?php if(!isset($_SESSION['uname'])){ ?>
					<li class="li_bg">
						<a href="<?php echo U('Member/login');?>" class="a_login">登录</a>
						<a href="<?php echo U('Member/register');?>" class="a_reg">注册</a>
					</li>
					<?php }else{ ?>
					<li class="li_bg">
						<a href="<?php echo U('Member/member');?>" class="a_login"><?php echo $_SESSION['uname'];?></a>
						<a href="<?php echo U('Member/out');?>" class="a_reg">退出</a>
					</li>
					<?php } ?>
					 

					<li>  
						<a href="<?php echo U('Order/index');?>" class="a_show">我的订单</a> 
						<div class="in_hide">
							<a href="javascript:void(0)" class="a_hide">待支付</a>
							<a href="javascript:void(0)" class="a_hide">待收货</a>
							<a href="javascript:void(0)" class="a_hide">待评价</a>
							<a href="javascript:void(0)" class="a_hide">修改订单</a>  
						</div>

					</li>
					<li class="li_buy"><a href="<?php echo U('Cart/index');?>">购物车</a><span>    <?php if($_SESSION['cart']['goods']){ ?><?php echo $_SESSION['cart']['total_rows'];?><?php }else{ ?>0<?php } ?></span></li>
				</ul>
			</div>
		</div> 
	</div>
<!-- =========头部结束====================================== -->
<div class="cart_main">
	<div class="clogo"><a href="http://localhost/project/shop"></a></div>
	<div class="r cart_progress">
		<dl>
			<dt class="finish"><i>1</i><span>我的购物车</span></dt>
			<dt><i>2</i><span>确认订单</span></dt>
			<dt><i>3</i><span>付款</span></dt>
			<dt><i>4</i><span>支付成功</span></dt>
		</dl>
	</div>

</div>


    <?php if($_SESSION['cart']['goods']){ ?>
<div class="cart_title"><i></i><p>购物车</p><span id="info" style="color:red;"></span></div>

<form action="    <?php if(!$_SESSION['uid']){ ?>javascript:void(0)<?php }else{ ?><?php echo U('Order/index');?><?php } ?>" method="post">
<table id="cart">
	<thead>
		<tr>
			<th>
			</th>
			<th>商品信息</th>
			<th>单价</th>
			<th>备注说明</th>
			<th>数量</th>
			<th>小计(元)</th> 
			<th>操作</th>
		</tr>
	</thead>
		<?php foreach ($g_info as $k=>$v){?>
			<tr class="<?php echo $k;?>">
				<td class='select'>
					<input type="checkbox" name="check[]" checked  value="<?php echo $k;?>"  class="check check_sel">
				</td>
				<td class='name'>
					<img src="http://localhost/project/shop/<?php echo $v['pic'];?>" width='100' height='100' alt="" />
					<a href=""><?php echo $v['name'];?></a>
				</td>
				<td class='price'><?php echo $v['price'];?></td>
				<td class='info'>
					
					<ul>
						<li>颜色：<?php echo $v['color'];?></li>
						<li>尺码：<?php echo $v['size'];?></li>
					</ul> 
				</td>
				
				<td class='number'>
					<span class='reduce'>-</span>
					<input type="text" value='<?php echo $v['num'];?>' class="num_s"/>
					<input type="hidden" value="<?php echo $v['price'];?>" class="price_s">
					<input type="hidden" value="<?php echo $k;?>" class="sid">
					<span class='plus'>+</span>
				</td>


				<td class='price price_total'>￥<?php echo $v['total'];?></td>
				<td class='delete'>
					<a href="javascript:void(0)" onclick="if(confirm('确定删除吗?')) location.href='<?php echo U('Cart/del_cart',array('g_id'=>$k));?>'">删除</a> 
				</td>
				 
			</tr>
		<?php }?>
	<tr>
		<td colspan='6' class='count'>
			<div class='total'>
				<input type="checkbox" name="" checked id="check" class="sel_all check"/> 全选
				
				<a href="javascript:void(0)" id='del_cart'>删除选中商品</a>
				<a href="javascript:void(0)" id='del_all' onclick="if(confirm('确定清空吗？')) location.href='<?php echo U('del_all');?>'">清空购物车</a>
				<p>商品金额：<span id='subtotal'>￥<?php echo $total['total'];?></span></p>
				<p>商品总数：<span id='subtotal1'><?php echo $total['total_rows'];?></span></p>
			</div>
			<div class='sub-btn'>
				<input type="submit" value="" class="buy     <?php if(!$_SESSION['uid']){ ?>rotateInUpLeft dialog<?php } ?>"> 
			</div>
		</td>
	</tr>
</table>
</form>



<?php }else{ ?>

<table id="cart" class="cart_add">	
	<tr> 
		<td colspan='6' class='count'>
			<div class='total total_add'>
				<div class="nocart"></div>
				您的购物车还是空的，    <?php if(!$_SESSION['uid']){ ?><a href="<?php echo U('Member/login');?>">马上登录</a>可展示您之前加入购物车的商品<?php }else{ ?>赶快去<a href="http://localhost/project/shop">首页</a>挑选你喜欢的商品吧。:)<?php } ?>
			</div>
		</td>
	</tr>

</table>


<?php } ?>
<style type="text/css">
.in_tap{
	width:300px;height:270px;
	position: relative;　
}
.dl_l{
	width:300px;height:30px;
	background: #eee; 
}
.dl_l dt{
	width:100px;
	height:30px;　 
	float: left;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	color: #aaa;
	text-align: center;
	margin-left: 10px;
}
.dl_l dt.dt_cur{
	border-top: 2px solid #f90; 
	background: #fff; 
	color: #f90;
}
	</style>
		<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<div id="HBox">
<div class="in_tap">
<dl class="dl_l">
	<dt class="dt_cur" style="line-height: 30px;">登录</dt>
	<dt style="line-height: 30px;">注册</dt>
</dl>

<div class="div_s" style="width:300px;height:240px;position: absolute;top:30px;display: block;">
	
	<form action="<?php echo U('Member/login');?>" method="post"> 
<ul class="list">
	<li>
		<strong>账号 </strong><div class="fl"><input type="text" name="username_login" value="" class="ipt username" /></div>

	</li>

	<li>

		<strong>密码  </strong>

		<div class="fl"><input type="password" name="password_login" value="" class="ipt" /></div>

	</li>
	<li>
		<input type="checkbox" name="on" id="" style="margin-left: 30px;"/> 自动登录  
	</li>　

	<li><input type="submit" value="" class="submitBtn" /></li>

</ul>
</form>

</div>

<div class="div_s" style="width:300px;height:240px;position: absolute;top:30px;display: none;">
	
	
	<form action="" method="post" onsubmit="return false;"> 
<ul class="list">
	<!--<li class="li_c">欢迎您登录</li>-->

	<li>

		<strong>账号 </strong>

		<div class="fl"><input type="text" name="nickname" value="" class="ipt nickname" /></div>

	</li>

	<li>

		<strong>密码  </strong>

		<div class="fl"><input type="password" name="pas1" value="" class="ipt" /></div>

	</li>
	<li>

		<strong>确认密码  </strong>

		<div class="fl"><input type="password" name="pas2" value="" class="ipt" /></div>

	</li> 
	
	<li>

		<strong>验证码  </strong>

		<div class="fl"><input type="text" name="code" value="" class="ipt" style="width: 80px;"/></div>

	</li> 
	

	<li><input type="submit" value="" class="submitBtn submitBtn2" /></li>

</ul>
</form>


	


</div>
</div>
</div>
	<script>

$(function(){
	var $el = $('.dialog');
	$el.hDialog();
	
	//提交并验证表单
	$('.submitBtn').click(function() {
		var $username = $('.username');
		if($username.val() == ''){
			$.tooltip('用户名还没填呢...'); $phone.focus();
		}else{
			$.tooltip('登录成功',500,true);
			setTimeout(function(){
				$el.hDialog('close',{box:'#HBox'},'<?php echo U('Order/index');?>');  //跳转链接~
			},1000);
		}

	});
});

</script>
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!--S foot -->
<div class="foot2"> 
	<div class="foot2_c">
		<dl class="dl_f2">
			<dt class="dt_f2_s"><a href="http://www.houdunwang.com/">后盾网</a></dt> 
			<dt class="dt_f2_s"><a href="http://bbs.houdunwang.com/">后盾网论坛</a></dt>
			<dt class="dt_f2_s"><a href="http://www.baidu.com">百度</a></dt>
		</dl>
		<p class="p_w">Copyright © 2015-2015<span>***.com</span><a>易购</a>All Rights Reserved.<a>京ICP备********号</a></p>
		<img src="http://localhost/project/shop/Static/Index/Images/i_bg.jpg" alt="" class="in_img">
	</div>
</div>
</body>
</html>